class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        multiset<char> set;
        for(char item : magazine){
            set.insert(item);
        }

        for(char item : ransomNote){
            auto iterator = set.find(item);
            if(iterator != set.end()){
                set.erase(iterator);
            } else {
                return false;
            }
        }

        return true;
    }
};